#--------------------------------异常处理
# def spam(divideBy):
#     try:
#         return 42 / divideBy
#     except ZeroDivisionError:
#         print('Error:Invalid arguement')

# print(spam(42))
# print(spam(12))
# print(spam(0))
# print(spam(1))

# def spam(divideBy):
#     return 42 / divideBy

# try: 
#     print(spam(2))
#     print(spam(12))
#     print(spam(0))
# except ZeroDivisionError:
#     print('Error:Invalid arguement')
#     print(spam(1))


#--------------Zigzag程序
import time,sys
indent = 0 #缩进
indentIncreasing = True #是否缩进
try:
    while True:   #主循环
        print(' ' * indent, end = '')
        print('********')
        time.sleep(1)    #停顿时间

        if indentIncreasing: #增加缩进
            indent = indent + 1
            if indent == 5: #改变缩进方向
                indentIncreasing = False
        else:  #减少缩进
            indent = indent - 1
            if indent == 0: #改变缩进方向
                indentIncreasing = True
except KeyboardInterrupt:
    sys.exit()


